package com.ysm.smfu.food.presenter;

import com.ysm.smfu.food.model.FoodTuiKuanModel;
import com.ysm.smfu.food.model.FoodTuiKuanModelImp;
import com.ysm.smfu.food.view.FoodTuikuanDetailView;

/**
 * Created by Administrator on 2017/4/6.
 */
public class FoodTuiKuanPerSenterImp implements FoodTuiKuanPersenter {

    private final FoodTuikuanDetailView foodTuikuanDetailView;
    private final FoodTuiKuanModel foodTuiKuanModel;

    public FoodTuiKuanPerSenterImp(FoodTuikuanDetailView foodTuikuanDetailView) {
        this.foodTuikuanDetailView = foodTuikuanDetailView;
        foodTuiKuanModel = new FoodTuiKuanModelImp();
    }

    @Override
    public void showPage() {
        foodTuiKuanModel.getData(new FoodTuiKuanModelImp.CallBack() {
            @Override
            public void onSuccess(String money, String type, String isHas, int flow, String num) {
                foodTuikuanDetailView.showMoneyAndType(money, type, isHas);
                foodTuikuanDetailView.showFlow(flow);
                foodTuikuanDetailView.setNumber(num);
            }

            @Override
            public void onFail(String msg) {
                foodTuikuanDetailView.showError(msg);
            }
        });
    }

}
